﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace uTorrentExtractor
{
    public class ErrorLog : ISerializable
    {
        private DateTime _when;
        private string _message;

        public ErrorLog()
        {
        }

        public ErrorLog(string message)
        {
            _when = DateTime.Now;
            _message = message;
        }

        public ErrorLog(SerializationInfo info, StreamingContext ctxt)
        {
            this.Message = (string)info.GetValue("Message", typeof(string));
            this.When = (DateTime)info.GetValue("DateUnpacked", typeof(DateTime));
        }

        public string Message
        {
            get
            {
                return _message;
            }
            set
            {
                _message = value;
            }
        }

        public DateTime When
        {
            get
            {
                return _when;
            }
            set
            {
                _when = value;
            }
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Message", Message);
            info.AddValue("When", When);
        }
    }
}
